package com.example.service.Impl;

import com.example.entity.EasybuyProductCategory;
import com.example.mapper.EasybuyProductCategoryMapper;
import com.example.service.EasybuyProductCategoryMapperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EasybuyProductCategoryMapperServiceImpl implements EasybuyProductCategoryMapperService {

    @Autowired
    public EasybuyProductCategoryMapper easybuyProductCategoryMapper;


    /*@Override
    public List<EasybuyProductCategory> findAlltype(Integer type) {
        return easybuyProductCategoryMapper.findAlltype(type);
    }*/

    @Override
    public List<EasybuyProductCategory> findAllid(Integer id) {
        List<EasybuyProductCategory> allid  = easybuyProductCategoryMapper.findAlltype(1);
        for (int i=0; i<allid.size();i++){
            allid.get(i).setListEasyBuy(easybuyProductCategoryMapper.findAllid(allid.get(i).getId()));
            for (int j=0; j<allid.get(i).getListEasyBuy().size();j++){
                allid.get(i).getListEasyBuy().get(j).setListEasyBuy(easybuyProductCategoryMapper.findAllid(allid.get(i).getListEasyBuy().get(j).getId()));

            }
        }
        return allid;
    }

}
